home *** CD-ROM | disk | FTP | other *** search
/ NetNews Offline 2 / NetNews Offline Volume 2.iso / news / comp / std / c++ / 996 < prev    next >
Encoding:
Internet Message Format  |  1996-08-06  |  2.2 KB

  1. From: thp@cs.ucr.edu (Tom Payne)
  2. Message-ID: <4ka0j3$228@galaxy.ucr.edu>
  3. X-Original-Date: 8 Apr 1996 03:18:59 GMT
  4. Path: in2.uu.net!bounce-back
  5. Date: 08 Apr 96 09:02:15 GMT
  6. Approved: fjh@cs.mu.oz.au
  7. Newsgroups: comp.std.c++
  8. Subject: Re: Referencing pointers after delete
  9. Organization: University of California, Riverside
  10. References: <4jmibl$qvt@mulga.cs.mu.OZ.AU> <4jp5dv$lbj@engnews1.Eng.Sun.COM>
  11. X-Newsreader: TIN [UNIX 1.3 950824BETA PL0]
  12. X-Auth: PGPMoose V1.1 PGP comp.std.c++
  13.     iQBFAgUBMWjWIOEDnX0m9pzZAQEpXQF+NXKbvvHfvEqnER5Hwm5ePvd7tNodxZ4l
  14.     QydUwLu0Cvlqvy8YvIGwcNkAvDXjPYx7
  15.     =3bwg
  16.  
  17. David Vandevoorde (vandevod@cs.rpi.edu) wrote:
  18. : >>>>> "TP" == Tom Payne <thp@cs.ucr.edu> writes:
  19. : [...]
  20. : TP> This is probably the hub of our difference: I have difficulty
  21. : TP> imagining a reasonable architecture that does something other than
  22. : TP> ignoring or trapping the reading of invalid pointers.  (Granted,
  23. : TP> "reasonable" is in the eye of the beholder.)
  24. : On the contrary, I think it could be a quite common thing. Many
  25. : architectures memory-map I/O and it's perfectly imaginible that:
  26. :     int x = *p;
  27. : where p is an invalid pointer triggers some I/O operation because
  28. : p happens to point into such an ``I/O area''. The standard cannot
  29. : reasonably be expected to say what can or cannot happen in those
  30. : cirucmstances.
  31.  
  32. Right!  Everyone agrees that dereferencing an invalid pointer should
  33. yield undefined hehavior.  
  34.  
  35. By "reading of invalid pointers", I mean the reading of a pointer
  36. object at a time when it happens to contain an invalid value, as in:
  37.      delete p;
  38.      cout << int(p);
  39. which yields "undefined behavior" under the current standards.
  40. As I understand memory-mapped I/O, it is the reading of those
  41. I/O locations themselves that produces the side effects, not
  42. simply reading the value of a pointer to one.
  43.  
  44. Tom Payne (thp@cs.ucr.edu)
  45. ---
  46. [ comp.std.c++ is moderated.  To submit articles: try just posting with      ]
  47. [ your news-reader.  If that fails, use mailto:std-c++@ncar.ucar.edu         ]
  48. [ FAQ:      http://reality.sgi.com/employees/austern_mti/std-c++/faq.html    ]
  49. [ Policy:   http://reality.sgi.com/employees/austern_mti/std-c++/policy.html ]
  50. [ Comments? mailto:std-c++-request@ncar.ucar.edu                             ]
  51.